Skip to main content

mainStack

Type

property

Summary

Specifies which main stack a substack belongs to.

Syntax

set the mainStack of <stack> to <mainStack>

Description

Use the mainStack property to organize stacks in files.

Each LiveCode file contains either a single main stack, or a main stack and one or more substacks. You can use this capability to bundle several related stacks into a single file for easy distribution, or to organize the stacks into categories, or to allow several stacks to inherit properties from the same main stack.

The mainStack of a stack file is the main stack in that file. (Each stack file can have only one main stack.)

The mainStack of a main stack is itself.

The mainStack of a substack is the main stack in that substack's file.

Changing a stack's mainStack property moves it into the same file as the specified main stack. The stack becomes a substack of the specified mainStack.

Changing a substack's mainStack property to itself makes the substack into an independent main stack (and removes it from the original main stack's substacks property). The next time you save the stack, LiveCode will prompt you for a file name and location for the stack.

You can set the mainStack property of a stack to the name of any open stack.

note

The mainStack property is simply the short name of the main stack, not a full stack reference.

Examples

set the mainStack of this stack to "Central"
go the mainStack of stack "/Disk/Folder/file.rev"
set the mainStack of stack "Hello" to "Goodbye"

property: name, substacks, stackFiles

command: revert

function: files, stacks, mainStacks

glossary: property, substack, stack file, main stack, prompt, object reference

keyword: string, file

message: mainStackChanged

object: stack

Compatibility and Support

Introduced

LiveCode 1.0

OS

mac

windows

linux

ios

android

Platforms

desktop

server

mobile

Thank you for your feedback!

Was this page helpful?